﻿using System;
using SoftSource.Ria;
using SoftSource.Timecard.Web.Data;

namespace SoftSource.Timecard.Model
{
    public sealed partial class ProjectManagerModel : IModelEntities
    {
        #region Initalize Entity Wrappers
        private void InitializeEntityWrappers()
        {
            this.InitializeStaticReadOnlyEntityWrappers();
            this.InitializeReadOnlyEntityWrappers();
            this.InitializeReadWriteEntityWrappers();
        }

        private void InitializeStaticReadOnlyEntityWrappers()
        {
            this.Roles = new ReadOnlyEntityWrapper<Role>(this.staticTypes, this.staticTypes.GetRolesQuery);
            this.Reports = new ReadOnlyEntityWrapper<Report>(this.staticTypes, this.staticTypes.GetReportsQuery);
            this.UserTypes = new ReadOnlyEntityWrapper<UserType>(this.staticTypes, this.staticTypes.GetUserTypesQuery);
            this.ProjectTypes = new ReadOnlyEntityWrapper<ProjectType>(this.staticTypes, this.staticTypes.GetProjectTypesQuery);
            this.RevenueTypes = new ReadOnlyEntityWrapper<RevenueType>(this.staticTypes, this.staticTypes.GetRevenueTypesQuery);
            this.BillingStates = new ReadOnlyEntityWrapper<BillingState>(this.staticTypes, this.staticTypes.GetBillingStatesQuery);
            this.ProjectStatuses = new ReadOnlyEntityWrapper<ProjectStatus>(this.staticTypes, this.staticTypes.GetProjectStatusQuery);
            this.BillingFrequencies = new ReadOnlyEntityWrapper<BillingFrequency>(this.staticTypes, this.staticTypes.GetBillingFrequenciesQuery);
        }

        private void InitializeReadOnlyEntityWrappers()
        {
            this.UserSummaries = new ReadOnlyEntityWrapper<UserSummary>(this.readOnlyTypes, this.readOnlyTypes.GetUserSummariesQuery);
            this.ProjectSummaries = new ReadOnlyEntityWrapper<ProjectSummary>(this.readOnlyTypes, this.readOnlyTypes.GetProjectSummariesQuery);
            this.CategorySummaries = new ReadOnlyEntityWrapper<CategorySummary>(this.readOnlyTypes, this.readOnlyTypes.GetCategorySummariesQuery);
            this.CustomerSummaries = new ReadOnlyEntityWrapper<CustomerSummary>(this.readOnlyTypes, null);
            this.MilestoneSummaries = new ReadOnlyEntityWrapper<MilestoneSummary>(this.readOnlyTypes, null);
            this.CustomerUserSummaries = new ReadOnlyEntityWrapper<CustomerUserSummary>(this.readOnlyTypes, null);
            this.ProjectMemberSummaries = new ReadOnlyEntityWrapper<ProjectMemberSummary>(this.readOnlyTypes, null);
            this.ProjectCategorySummaries = new ReadOnlyEntityWrapper<ProjectCategorySummary>(this.readOnlyTypes, this.readOnlyTypes.GetProjectCategorySummariesQuery);
            this.CustomerProjectSummaries = new ReadOnlyEntityWrapper<CustomerProjectSummary>(this.readOnlyTypes, null);
        }

        private void InitializeReadWriteEntityWrappers()
        {
            this.Entries = new EntityWrapper<EntryLog>(this.entries);            
        }
        #endregion Initalize Entity Wrappers

        #region Static
        public ReadOnlyEntityWrapper<Role> Roles { get; private set; }
        public ReadOnlyEntityWrapper<Report> Reports { get; private set; }
        public ReadOnlyEntityWrapper<UserType> UserTypes { get; private set; }
        public ReadOnlyEntityWrapper<ProjectType> ProjectTypes { get; private set; }
        public ReadOnlyEntityWrapper<RevenueType> RevenueTypes { get; private set; }
        public ReadOnlyEntityWrapper<BillingState> BillingStates { get; private set; }
        public ReadOnlyEntityWrapper<ProjectStatus> ProjectStatuses { get; private set; }
        public ReadOnlyEntityWrapper<BillingFrequency> BillingFrequencies { get; private set; }
        #endregion Static

        #region Read-Only
        public ReadOnlyEntityWrapper<UserSummary> UserSummaries { get; private set; }
        public ReadOnlyEntityWrapper<ProjectSummary> ProjectSummaries { get; private set; }
        public ReadOnlyEntityWrapper<CategorySummary> CategorySummaries { get; private set; }
        public ReadOnlyEntityWrapper<CustomerSummary> CustomerSummaries { get; private set; }
        public ReadOnlyEntityWrapper<MilestoneSummary> MilestoneSummaries { get; private set; }
        public ReadOnlyEntityWrapper<CustomerUserSummary> CustomerUserSummaries { get; private set; }
        public ReadOnlyEntityWrapper<ProjectMemberSummary> ProjectMemberSummaries { get; private set; }
        public ReadOnlyEntityWrapper<ProjectCategorySummary> ProjectCategorySummaries { get; private set; }
        public ReadOnlyEntityWrapper<CustomerProjectSummary> CustomerProjectSummaries { get; private set; }
        #endregion Read-Only

        #region Read-Write
        public EntityWrapper<EntryLog> Entries { get; private set; }
        #endregion Read-Write

        #region Unused

        public EntityWrapper<User> Users
        {
            get { throw new NotImplementedException(); }
        }

        public EntityWrapper<Project> Projects
        {
            get { throw new NotImplementedException(); }
        }

        public EntityWrapper<Customer> Customers
        {
            get { throw new NotImplementedException(); }
        }

        public EntityWrapper<Category> Categories
        {
            get { throw new NotImplementedException(); }
        }

        public EntityWrapper<Milestone> Milestones
        {
            get { throw new NotImplementedException(); }
        }

        public EntityWrapper<CustomerUser> CustomerUsers
        {
            get { throw new NotImplementedException(); }
        }

        public EntityWrapper<ProjectMember> ProjectMembers
        {
            get { throw new NotImplementedException(); }
        }

        public EntityWrapper<CustomerProject> CustomerProjects
        {
            get { throw new NotImplementedException(); }
        }

        public EntityWrapper<ProjectCategory> ProjectCategories
        {
            get { throw new NotImplementedException(); }
        }

        public EntityWrapper<InvoicingProject> InvoicingProjects
        {
            get { throw new NotImplementedException(); }
        }

        #endregion Unused
    }
}
